# -*- coding: utf-8 -*-



import cv2 

img = cv2.imread("images/a.jpg")
print ("img",img)
print("shape",img.shape)
#图像的垂直尺寸（高度）
print ("shape[0]",img.shape[0])
#图像的水平尺寸（宽度）
print ("shape[1]",img.shape[1])
#图像的通道数
print ("shape[2]",img.shape[2])

#图片大小
print ("size",img.size)
#图片编码
print (img.dtype)

if(img is None):
  print ('read img error!')  
else:
  print ("read img ok!")
  cv2.namedWindow("src",cv2.WINDOW_AUTOSIZE)
  cv2.imshow("src", img)

 
  ch = cv2.waitKey(0)
  if(ch==27):
    cv2.destroyAllWindows()
  elif(ch==ord('s')):
    cv2.imwrite("images/1.bmp",img)
    cv2.destroyAllWindows()


